package com.lkm.asking.service.Impl;

import com.lkm.asking.dao.SureKeyDao;
import com.lkm.asking.entity.SureKey;
import com.lkm.asking.service.KeyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class KeyServiceImpl implements KeyService {
    @Autowired
    SureKeyDao sureKeyDao;

    @Override
    public int addKey(SureKey sureKey) {
        if (sureKeyDao.inSureKey(sureKey)==0){
        return 0;}
        else{
            return  -1;
        }
    }

    @Override
    public SureKey selectKey(String username) {
        return sureKeyDao.getKey(username);
    }

    @Override
    public String rTime(String username) {
        return sureKeyDao.getTime(username);
    }
}
